import 'package:wanxiang_app/generated/json/base/json_convert_content.dart';
import 'package:wanxiang_app/bean/detai_new_entity.dart';

DetaiNewEntity $DetaiNewEntityFromJson(Map<String, dynamic> json) {
  final DetaiNewEntity detaiNewEntity = DetaiNewEntity();
  final int? code = jsonConvert.convert<int>(json['code']);
  if (code != null) {
    detaiNewEntity.code = code;
  }
  final String? msg = jsonConvert.convert<String>(json['msg']);
  if (msg != null) {
    detaiNewEntity.msg = msg;
  }
  final DetaiNewData? data = jsonConvert.convert<DetaiNewData>(json['data']);
  if (data != null) {
    detaiNewEntity.data = data;
  }
  return detaiNewEntity;
}

Map<String, dynamic> $DetaiNewEntityToJson(DetaiNewEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['code'] = entity.code;
  data['msg'] = entity.msg;
  data['data'] = entity.data.toJson();
  return data;
}

extension DetaiNewEntityExtension on DetaiNewEntity {
  DetaiNewEntity copyWith({
    int? code,
    String? msg,
    DetaiNewData? data,
  }) {
    return DetaiNewEntity()
      ..code = code ?? this.code
      ..msg = msg ?? this.msg
      ..data = data ?? this.data;
  }
}

DetaiNewData $DetaiNewDataFromJson(Map<String, dynamic> json) {
  final DetaiNewData detaiNewData = DetaiNewData();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    detaiNewData.id = id;
  }
  final int? isSelf = jsonConvert.convert<int>(json['is_self']);
  if (isSelf != null) {
    detaiNewData.isSelf = isSelf;
  }
  final String? imgUrl = jsonConvert.convert<String>(json['img_url']);
  if (imgUrl != null) {
    detaiNewData.imgUrl = imgUrl;
  }
  final String? addTime = jsonConvert.convert<String>(json['add_time']);
  if (addTime != null) {
    detaiNewData.addTime = addTime;
  }
  final String? title = jsonConvert.convert<String>(json['title']);
  if (title != null) {
    detaiNewData.title = title;
  }
  final String? content = jsonConvert.convert<String>(json['content']);
  if (content != null) {
    detaiNewData.content = content;
  }
  final String? categoryText = jsonConvert.convert<String>(
      json['category_text']);
  if (categoryText != null) {
    detaiNewData.categoryText = categoryText;
  }
  final int? sellPrice = jsonConvert.convert<int>(json['sell_price']);
  if (sellPrice != null) {
    detaiNewData.sellPrice = sellPrice;
  }
  final int? isMsg = jsonConvert.convert<int>(json['is_msg']);
  if (isMsg != null) {
    detaiNewData.isMsg = isMsg;
  }
  final int? isIndulge = jsonConvert.convert<int>(json['is_indulge']);
  if (isIndulge != null) {
    detaiNewData.isIndulge = isIndulge;
  }
  final bool? isShoucang = jsonConvert.convert<bool>(json['is_shoucang']);
  if (isShoucang != null) {
    detaiNewData.isShoucang = isShoucang;
  }
  final String? channelName = jsonConvert.convert<String>(json['channel_name']);
  if (channelName != null) {
    detaiNewData.channelName = channelName;
  }
  final String? channelId = jsonConvert.convert<String>(json['channel_id']);
  if (channelId != null) {
    detaiNewData.channelId = channelId;
  }
  final String? categoryId = jsonConvert.convert<String>(json['category_id']);
  if (categoryId != null) {
    detaiNewData.categoryId = categoryId;
  }
  final String? phoneNumber = jsonConvert.convert<String>(json['phone_number']);
  if (phoneNumber != null) {
    detaiNewData.phoneNumber = phoneNumber;
  }
  final String? wxNumber = jsonConvert.convert<String>(json['wx_number']);
  if (wxNumber != null) {
    detaiNewData.wxNumber = wxNumber;
  }
  final String? qqNumber = jsonConvert.convert<String>(json['qq_number']);
  if (qqNumber != null) {
    detaiNewData.qqNumber = qqNumber;
  }
  final String? accountSource = jsonConvert.convert<String>(
      json['account_source']);
  if (accountSource != null) {
    detaiNewData.accountSource = accountSource;
  }
  final String? isBargain = jsonConvert.convert<String>(json['is_bargain']);
  if (isBargain != null) {
    detaiNewData.isBargain = isBargain;
  }
  final String? gameAccount = jsonConvert.convert<String>(json['game_account']);
  if (gameAccount != null) {
    detaiNewData.gameAccount = gameAccount;
  }
  final String? fields = jsonConvert.convert<String>(json['fields']);
  if (fields != null) {
    detaiNewData.fields = fields;
  }
  final String? goodGuid = jsonConvert.convert<String>(json['good_guid']);
  if (goodGuid != null) {
    detaiNewData.goodGuid = goodGuid;
  }
  final String? goodName = jsonConvert.convert<String>(json['good_name']);
  if (goodName != null) {
    detaiNewData.goodName = goodName;
  }
  final String? status = jsonConvert.convert<String>(json['status']);
  if (status != null) {
    detaiNewData.status = status;
  }
  final String? roleText = jsonConvert.convert<String>(json['role_text']);
  if (roleText != null) {
    detaiNewData.roleText = roleText;
  }
  final List<DetaiNewDataAlbums>? albums = (json['albums'] as List<dynamic>?)
      ?.map(
          (e) =>
      jsonConvert.convert<DetaiNewDataAlbums>(e) as DetaiNewDataAlbums)
      .toList();
  if (albums != null) {
    detaiNewData.albums = albums;
  }
  final List<DetaiNewDataExtended>? extended = (json['extended'] as List<
      dynamic>?)
      ?.map(
          (e) =>
      jsonConvert.convert<DetaiNewDataExtended>(e) as DetaiNewDataExtended)
      .toList();
  if (extended != null) {
    detaiNewData.extended = extended;
  }
  final List<DetaiNewDataCategory>? category = (json['category'] as List<
      dynamic>?)
      ?.map(
          (e) =>
      jsonConvert.convert<DetaiNewDataCategory>(e) as DetaiNewDataCategory)
      .toList();
  if (category != null) {
    detaiNewData.category = category;
  }
  return detaiNewData;
}

Map<String, dynamic> $DetaiNewDataToJson(DetaiNewData entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['is_self'] = entity.isSelf;
  data['img_url'] = entity.imgUrl;
  data['add_time'] = entity.addTime;
  data['title'] = entity.title;
  data['content'] = entity.content;
  data['category_text'] = entity.categoryText;
  data['sell_price'] = entity.sellPrice;
  data['is_msg'] = entity.isMsg;
  data['is_indulge'] = entity.isIndulge;
  data['is_shoucang'] = entity.isShoucang;
  data['channel_name'] = entity.channelName;
  data['channel_id'] = entity.channelId;
  data['category_id'] = entity.categoryId;
  data['phone_number'] = entity.phoneNumber;
  data['wx_number'] = entity.wxNumber;
  data['qq_number'] = entity.qqNumber;
  data['account_source'] = entity.accountSource;
  data['is_bargain'] = entity.isBargain;
  data['game_account'] = entity.gameAccount;
  data['fields'] = entity.fields;
  data['good_guid'] = entity.goodGuid;
  data['good_name'] = entity.goodName;
  data['status'] = entity.status;
  data['role_text'] = entity.roleText;
  data['albums'] = entity.albums.map((v) => v.toJson()).toList();
  data['extended'] = entity.extended.map((v) => v.toJson()).toList();
  data['category'] = entity.category.map((v) => v.toJson()).toList();
  return data;
}

extension DetaiNewDataExtension on DetaiNewData {
  DetaiNewData copyWith({
    int? id,
    int? isSelf,
    String? imgUrl,
    String? addTime,
    String? title,
    String? content,
    String? categoryText,
    int? sellPrice,
    int? isMsg,
    int? isIndulge,
    bool? isShoucang,
    String? channelName,
    String? channelId,
    String? categoryId,
    String? phoneNumber,
    String? wxNumber,
    String? qqNumber,
    String? accountSource,
    String? isBargain,
    String? gameAccount,
    String? fields,
    String? goodGuid,
    String? goodName,
    String? status,
    String? roleText,
    List<DetaiNewDataAlbums>? albums,
    List<DetaiNewDataExtended>? extended,
    List<DetaiNewDataCategory>? category,
  }) {
    return DetaiNewData()
      ..id = id ?? this.id
      ..isSelf = isSelf ?? this.isSelf
      ..imgUrl = imgUrl ?? this.imgUrl
      ..addTime = addTime ?? this.addTime
      ..title = title ?? this.title
      ..content = content ?? this.content
      ..categoryText = categoryText ?? this.categoryText
      ..sellPrice = sellPrice ?? this.sellPrice
      ..isMsg = isMsg ?? this.isMsg
      ..isIndulge = isIndulge ?? this.isIndulge
      ..isShoucang = isShoucang ?? this.isShoucang
      ..channelName = channelName ?? this.channelName
      ..channelId = channelId ?? this.channelId
      ..categoryId = categoryId ?? this.categoryId
      ..phoneNumber = phoneNumber ?? this.phoneNumber
      ..wxNumber = wxNumber ?? this.wxNumber
      ..qqNumber = qqNumber ?? this.qqNumber
      ..accountSource = accountSource ?? this.accountSource
      ..isBargain = isBargain ?? this.isBargain
      ..gameAccount = gameAccount ?? this.gameAccount
      ..fields = fields ?? this.fields
      ..goodGuid = goodGuid ?? this.goodGuid
      ..goodName = goodName ?? this.goodName
      ..status = status ?? this.status
      ..roleText = roleText ?? this.roleText
      ..albums = albums ?? this.albums
      ..extended = extended ?? this.extended
      ..category = category ?? this.category;
  }
}

DetaiNewDataAlbums $DetaiNewDataAlbumsFromJson(Map<String, dynamic> json) {
  final DetaiNewDataAlbums detaiNewDataAlbums = DetaiNewDataAlbums();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    detaiNewDataAlbums.id = id;
  }
  final String? originalPath = jsonConvert.convert<String>(
      json['original_path']);
  if (originalPath != null) {
    detaiNewDataAlbums.originalPath = originalPath;
  }
  return detaiNewDataAlbums;
}

Map<String, dynamic> $DetaiNewDataAlbumsToJson(DetaiNewDataAlbums entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['original_path'] = entity.originalPath;
  return data;
}

extension DetaiNewDataAlbumsExtension on DetaiNewDataAlbums {
  DetaiNewDataAlbums copyWith({
    int? id,
    String? originalPath,
  }) {
    return DetaiNewDataAlbums()
      ..id = id ?? this.id
      ..originalPath = originalPath ?? this.originalPath;
  }
}

DetaiNewDataExtended $DetaiNewDataExtendedFromJson(Map<String, dynamic> json) {
  final DetaiNewDataExtended detaiNewDataExtended = DetaiNewDataExtended();
  final String? controlType = jsonConvert.convert<String>(json['control_type']);
  if (controlType != null) {
    detaiNewDataExtended.controlType = controlType;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    detaiNewDataExtended.name = name;
  }
  final String? title = jsonConvert.convert<String>(json['title']);
  if (title != null) {
    detaiNewDataExtended.title = title;
  }
  final String? itemOption = jsonConvert.convert<String>(json['item_option']);
  if (itemOption != null) {
    detaiNewDataExtended.itemOption = itemOption;
  }
  return detaiNewDataExtended;
}

Map<String, dynamic> $DetaiNewDataExtendedToJson(DetaiNewDataExtended entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['control_type'] = entity.controlType;
  data['name'] = entity.name;
  data['title'] = entity.title;
  data['item_option'] = entity.itemOption;
  return data;
}

extension DetaiNewDataExtendedExtension on DetaiNewDataExtended {
  DetaiNewDataExtended copyWith({
    String? controlType,
    String? name,
    String? title,
    String? itemOption,
  }) {
    return DetaiNewDataExtended()
      ..controlType = controlType ?? this.controlType
      ..name = name ?? this.name
      ..title = title ?? this.title
      ..itemOption = itemOption ?? this.itemOption;
  }
}

DetaiNewDataCategory $DetaiNewDataCategoryFromJson(Map<String, dynamic> json) {
  final DetaiNewDataCategory detaiNewDataCategory = DetaiNewDataCategory();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    detaiNewDataCategory.id = id;
  }
  final String? title = jsonConvert.convert<String>(json['title']);
  if (title != null) {
    detaiNewDataCategory.title = title;
  }
  final int? channelId = jsonConvert.convert<int>(json['channel_id']);
  if (channelId != null) {
    detaiNewDataCategory.channelId = channelId;
  }
  final int? parentId = jsonConvert.convert<int>(json['parent_id']);
  if (parentId != null) {
    detaiNewDataCategory.parentId = parentId;
  }
  return detaiNewDataCategory;
}

Map<String, dynamic> $DetaiNewDataCategoryToJson(DetaiNewDataCategory entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['title'] = entity.title;
  data['channel_id'] = entity.channelId;
  data['parent_id'] = entity.parentId;
  return data;
}

extension DetaiNewDataCategoryExtension on DetaiNewDataCategory {
  DetaiNewDataCategory copyWith({
    int? id,
    String? title,
    int? channelId,
    int? parentId,
  }) {
    return DetaiNewDataCategory()
      ..id = id ?? this.id
      ..title = title ?? this.title
      ..channelId = channelId ?? this.channelId
      ..parentId = parentId ?? this.parentId;
  }
}